Subject: Looking for better way
From: Richard Barry Ling <[email-masked]>
To: [email-masked] (AMOS User group)
Date: Fri, 24 Sep 1993 20:07:31 +1000 (EST)

> 
> I am writing a small LOGO interpreter for my Daughter, to match the one
> she uses at school.  I'm using AMOS Creator on an A3000.
> 
> I need to have a small graphic element (the turtle) move over another
> large graphic without affecting it.  A sprite exhibits just these
> characteristics, and would be a wonderful choice except that I want the
> turtle to always point in the direction of motion and change color
> (a chamelian turtle?) when the drawing color is changed.  I don't know
> how to do this without storing MANY (all possible) sprite images.

I can see a couple of easy solutions to this problem.

For the colour change, why store huge numbers of images of the turtle in
each colour, when you can change the RGB value of the sprite?  Use colour
number 1 for the turtle images, and you can instantly chameleonize (?) the
turtle to match the current drawing colour using Colour 17,$RGB.

For the rotation, one idea is to store a sprite of the turtle pointing in
each direction, stepping by a certain angle.  You certainly won't need 360
images of the turtle rotating by 1 degree increments - you'll never notice
the change from one image to the next.  You may find that increments of say
10 degrees are plenty, giving only 36 images needed.  You then use arithmetic
to convert the angle in degrees to the image number you want.

Alternatively, you can generate the sprite for a particular angle on the
fly.  Set up a tiny invisible screen, and each time the turtle rotates, draw
the turtle onto the hidden screen using the trig functions.  Grab it with
the Get Sprite command, and you're away.  This should be plenty fast
enough.  Using this method, combined with the palette change mentioned
before, you don't need to store any sprites with your program at all!  Or,
you can use this method to initially generate your sprites for each angle,
and store them along with your program - it would sure beat drawing them by
hand!

> Alternatively, is there another method?  I have successfully done it
> using dual playfield... drawing the turtle on one screen and the graphics
> on a second... but I am limited (by AMOS) to low resolution.  I want to
> use 640x400 (hires) interlaced with at least 8 colors.  (After all,
> the Amiga version MUST look better than the Apple version, right?)

You can use the low-res sprite turtle on a high-res screen, but if you want
a high-res turtle too, you'll need to use bobs.  Everything I write above
will work for bobs too, except the colour numbers - you could draw your bob
in, say, colour 7 (assuming an 8-colour screen) and use Colour 7,$RGB to
change its colour to the current drawing colour.  Of course you won't be
able to use colour 7 for much else, since it will change all the time.  If
you need more colours, try using a 16-colour screen.

> 
> Any help is appreciated!
> 
>                                              Mark

I hope this does!

RL.

--
This has been a dinosaur-free announcement.

==========================  Generating: .signature
   Richard Ling             - colour analysis... complete
 [email-masked]     - clipping... complete
==========================  - rendering... 37.6%